<template>
  <div>
    <!-- 关注列表 -->
    <div class="focus">
      <div class="button" @click="$router.go(-1)">
        <span class="iconfont icon-arrow-left-bold"></span>
        返回
      </div>
      <div class="follow">
        <p>我的关注</p>
        <div class="item " v-for="(item, index) in follow" :key="index" @click="get(item)">
                          <span class="iconfont icon-iconhuxiangguanzhu">已关注</span>
          <a>
            <div class="img">
              <img :src="item.avatarUrl" alt="" />
            </div>
            <ul>
              <li>{{ item.nickname }}</li>
              <li>
                歌单：{{ item.playlistCount }} | 粉丝：{{ item.followeds }}
              </li>
            </ul>
          </a>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getFollows} from "../../api/base";
export default {
  data() {
    return {
      follow: "",
    };
  },
  methods: {
    getAll() {
      if(this.$store.state.userId2 == ''){
        let id = this.$route.query.id;
      getFollows({ uid: id }).then((data) => {
        console.log(data);
        this.follow = data.follow;
      });
      }else{
      let id = this.$store.state.userId2;
      getFollows({ uid: id }).then((data) => {
        console.log(data);
        this.follow = data.follow;
      });
      }
      // let id = this.$route.query.id;

    },
    get(item){
        console.log(item.userId);
        this.$router.push("/userInfo");
        this.$store.commit("saveUserId2",item.userId);
    }
  },
  created() {
    this.getAll();
  },
};
</script>

<style lang="less" scoped>
.focus {
  overflow: scroll;
  position: fixed;
  top: 0px;
  bottom: 0px;
  width: 100%;
  height: 100%;
  margin: auto;
  background: #FFFFFF;
  z-index: 10;
  .button {
    width: 150px;
    height: 45px;
    line-height: 45px;
    font-size: 35px;
    // background: #000;
    color: #1e1e1e;
    margin: 10px 0;
    position: absolute;
    top: 0;
    left: 0;
    span {
      display: inline-block;
      font-size: 40px;
      vertical-align: top;
    }
  }
  .follow {
    p {
      text-align: center;
      font-size: 34px;
    width: 235px;
    margin: 10px auto;
    }
    .item {
      padding: 28px 0px 20px 20px;
      border-bottom: 2px solid #e3e4e4;
      position: relative;
      span{
        font-size: 26px;
        position: absolute;
        top: 50%;
        right: 0;
        margin-top: -13px;
        margin-right: 30px;
      }
      a {
        display: flex;
        .img {
          flex: 0 0 100px;
          height: 100px;
          img {
            width: 100%;
            border-radius: 50%;
          }
        }
        ul {
          padding-top: 10px;
          flex: 1;
          li {
            font-size: 24px;
            color: #030006;
            height: 46px;
            line-height: 46px;
            text-indent: 30px;
            overflow: hidden;
            &:nth-child(2) {
              color: #676767;
            }
          }
        }
      }
    }
  }
}
</style>